package com.hr.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hr.entity.AoaRole;
import com.hr.service.AoaRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * (AoaRole)表控制层
 *
 * @author makejava
 * @since 2022-06-16 20:09:12
 */
@RestController
@RequestMapping("aoaRole")
public class AoaRoleController {
    /**
     * 服务对象
     */
    @Autowired
    private AoaRoleService aoaRoleService;

    /**
     * 查询角色列表
     * @return
     */
    @RequestMapping("/queryList")
    public Page<AoaRole> queryList(Page<AoaRole> page, String roleName){
        page  = aoaRoleService.queryList(page,roleName);
        return page;
    }

    /**
     * 保存或修改
     * @param aoaRole
     * @return
     */
    @PostMapping("/save")
    public boolean save(@RequestBody AoaRole aoaRole) {
        boolean save = aoaRoleService.save(aoaRole);
        return save;
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/delete")
    public boolean delete(Integer id) {
        return aoaRoleService.delete(id);
    }

    /**
     * 单值查询
     * @param id
     * @return
     */
    @GetMapping("/queryById")
    public AoaRole queryById(Integer id) {
        return aoaRoleService.queryById(id);
    }

}

